<template>
    <div class="handle-comprehensive-box"  :key="materialReviewExaminationKey">
        <div class="process-handling-card">
            <a-tabs type="card" v-model:activeKey="activeKey" @change="tabPaneChange">
                <a-tab-pane key="技术审评材料汇总" tab="材料汇总"></a-tab-pane>
                <a-tab-pane key="环节流转记录" tab="流转记录"></a-tab-pane>
            </a-tabs>
        </div>
        <div class="comprehensive-review-content" :style="{height: currentRow.isScyjBox?'calc(100vh - 121px)':(currentRow.isTopTabs?'calc(100vh - '+140+'px)':'calc(100vh - '+152+'px)'),borderTop:!currentRow.isTopTabs?'none' :'1px solid #38f'}">
            <div v-show="activeKey == '综合评定' && !comprehensiveReportState">
                <div style="display: flex;justify-content: space-between;" >
                    <div class="business-number">
                        <!-- <div class="business-number-dg">
                            <span class="business-name-text">业务分类：</span>
                            <span style="width: 139px;">{{ currentRow.fjclx }}</span>
                        </div> -->
                        <div class="business-number-dg">
                            <span class="business-name-text">评定编号：</span>
                            <a-input style="margin: 0 10px 0 3px;width: 230px;" @blur="saveData('fpdbh',currentRow.fpdbh)" placeholder="请输入评定编号" v-model:value="currentRow.fpdbh"/>
                            <a-button size="small" class="blue-btn" type="primary" @click="numbering('评定编号')" icon="file-done">取号</a-button>
                        </div>
                        <div class="business-number-dg">
                            <span class="business-name-text">综合评定结论：</span>
                            <compSelector
                                :key="fzhjgKey"
                                v-model="currentRow.fzhjg"
                                compType="Select"
                                :defaultValue="currentRow.fzhjg"
                                dictionaryType="审评结果"
                                @selectHandleChange="saveData('fzhjg',currentRow.fzhjg)"
                            />
                            <a-button style="margin-left: 20px;" size="small" class="blue-btn" type="primary" @click="numbering('生成报告内容')" icon="check-circle">生成报告内容</a-button>
                        </div>
                    </div>
                    <a-button id="fxqxqk-scbg-btn" class="green-l2-btn" type="primary" @click="generateReportChange('完成')" icon="check-circle">生成综合评定报告书</a-button>
                </div>
                <div>
                    <!-- <div style="display: flex;align-items: center;">
                        <span class="business-name-text">综合评定结论：</span>
                        <compSelector
                            :key="fzhjgKey"
                            v-model="currentRow.fzhjg"
                            compType="Select"
                            :defaultValue="currentRow.fzhjg"
                            dictionaryType="审评结果"
                            @selectHandleChange="saveData('fzhjg',currentRow.fzhjg)"
                        />
                        <a-button style="margin-left: 20px;" size="small" class="blue-btn" type="primary" @click="numbering('生成报告内容')" icon="check-circle">生成报告内容</a-button>
                    </div> -->
                    <div>
                        <a-textarea 
                            @blur="saveData('fzhjl',currentRow.fzhjl)"
                            placeholder="请输入报告内容"
                            v-model:value="currentRow.fzhjl"
                            :autosize="{ minRows: 10, maxRows: 10000 }"
                        ></a-textarea>
                    </div>
                    <div style="margin: 10px 0;">
                        <span>其他问题：</span>
                    </div>
                    <div>
                        <a-textarea 
                            @blur="saveData('fzhbgqtwt',currentRow.fzhbgqtwt)"
                            placeholder="请输入其他问题"
                            v-model:value="currentRow.fzhbgqtwt"
                            :autosize="{ minRows: 8, maxRows: 10000 }"
                        ></a-textarea>
                    </div>
                </div>
                <div style="display: flex;justify-content: flex-end;margin: 10px 0;">
                    <a-button class="blue-btn" type="primary" @click="activeKey = '综合评定'" icon="arrow-right">下一步</a-button>
                </div>
            </div>
            <div v-show="activeKey == '综合评定'  && comprehensiveReportState">
                <a-spin size="large" :spinning="programSpinning" :key="programSpinningKey" tip="正在加载中...">
                    <div v-if="programData.id" :key="programSpinningKey">
                        <div style="display: flex;justify-content: space-between;" >
                            <div>
                                <a-button
                                        style="margin-right: 15px;" 
                                        class="red-btn" type="primary" 
                                        @click="producerDelete(programData,'综合评定')" icon="delete">删除</a-button>
                                <!-- <a-button
                                style="margin-right: 15px;" 
                                class="blue-btn" type="primary" 
                                @click="refreshFile" icon="reload">刷新</a-button>

                                <a-button
                                style="margin-right: 15px;" 
                                class="blue-btn" type="primary" 
                                @click="downloadFiles(programData)" icon="download">下载</a-button>

                                <a-button
                                v-if="programData.fwjlx == '.pdf'"
                                style="margin-right: 15px;" 
                                class="blue-btn" type="primary" 
                                @click="reEdit" icon="form">重新编辑</a-button>

                                <a-button
                                v-if="programData.fwjlx !== '.pdf'"
                                style="margin-right: 15px;" 
                                class="blue-btn" type="primary" 
                                @click="saveFiles" icon="folder">保存</a-button>

                                <a-button
                                v-if="programData.fwjlx !== '.pdf'"
                                style="margin-right: 15px;" 
                                class="blue-btn" type="primary" 
                                @click="generatePDFClick" icon="file-pdf">生成PDF</a-button>

                                <a-button
                                v-if="programData.fwjlx == '.pdf'"
                                style="margin-right: 15px;" 
                                class="blue-btn" type="primary" 
                                @click="stampClick" icon="audit">盖章</a-button>

                                <a-button
                                v-if="programData.fwjlx !== '.pdf'"
                                style="margin-right: 15px;"
                                class="blue-btn" type="primary" 
                                @click="generatePDFStampClick" icon="audit">生成PDF并盖章</a-button>

                                <a-button 
                                v-if="programData.fwjlx !== '.pdf'"
                                class="blue-btn" type="primary" 
                                @click="reSelectTemplate" icon="select">重新选择模板</a-button> -->
                            </div>
                            <a-button class="orange-btn" type="primary" id="fxqxqk-cxbjqxx-btn" @click="generateReportChange('重新编辑')" icon="form">重新编辑综合评定报告书</a-button>
                        </div>
                        
                        <div :key="iframeKey" style="display: flex;justify-content: center;">
                            <iframe 
                                v-if="iframeSrc"
                                :key="iframeKey"
                                :src="iframeSrc" 
                                ref="iframeServerEditingRef" 
                                scrolling="auto" 
                                width="100%"
                                :height="(windowInnerHeight -170 )+'px'"
                                style="border: 0;"
                            ></iframe>
                            <span v-else>当前文件发生错误，请刷新！</span>
                        </div>
                        <!-- {{ programData }} -->
                    </div>
                    <div v-else>
                        <div style="display: flex;justify-content: space-between;margin: 0 15px;" >
                            <a-upload style="display: inline-block;" :beforeUpload="$event=>{return false}" :showUploadList="false" action="" @change="singleUploadCahnge($event,'综合评定报告书')">
                                <a-button
                                class="blue-btn" 
                                style="width: 124px;"
                                type="primary" icon="upload">上传</a-button>
                            </a-upload>
                            <a-button class="orange-btn" type="primary" id="fxqxqk-cxbjqxx-btn" @click="generateReportChange('重新编辑')" icon="form">重新编辑综合评定报告书</a-button>
                        </div>
                        <!-- <selectTemplateNoModel
                        :key="programTemplateKey"
                         ref="selectTemplateNoModel1Ref" 
                         @selectTemplateComplete="selectTemplateComplete" 
                         @programSpinningChange="programSpinningChange" /> -->
                    </div>
                </a-spin>
            </div>
            <div v-show="activeKey == '移送函报告'">
                <div style="display: flex;justify-content: space-between;margin-right: 15px;align-items: flex-end;">
                    <div class="business-number">
                        <div class="business-number-dg">
                            <span class="business-name-text" style="width: 84px;" >移送编号：</span>
                            <a-input style="margin: 0 10px 0 3px;width: 230px;" @blur="saveData('fyshbh',currentRow.fyshbh)" placeholder="请输入移送编号" v-model:value="currentRow.fyshbh"/>
                            <a-button size="small" class="blue-btn" type="primary" @click="numbering('移送编号')" icon="file-done">取号</a-button>
                        </div>
                    </div>
                    <!-- <span v-if="!transferLetterData.id" style="color: red;font-weight: 600;">(注：当前暂无移送函报告文件，请先选择模板进行移送函报告)</span> -->
                </div>
                
                <a-spin size="large" :spinning="programSpinning" :key="programSpinningKey" tip="正在加载中...">
                    <div v-if="transferLetterData.id" :key="programSpinningKey" style="margin: 0 15px;">
                        
                        <div>
                            <a-button
                                style="margin-right: 15px;" 
                                class="red-btn" type="primary" 
                                @click="producerDelete(transferLetterData,'移送函报告')" icon="delete">删除</a-button>
                            <!-- <a-button
                            style="margin-right: 15px;" 
                            class="blue-btn" type="primary" 
                            @click="refreshFile" icon="reload">刷新</a-button>

                            <a-button
                            style="margin-right: 15px;" 
                            class="blue-btn" type="primary" 
                            @click="downloadFiles(transferLetterData)" icon="download">下载</a-button>

                            <a-button
                            v-if="transferLetterData.fwjlx == '.pdf'"
                            style="margin-right: 15px;" 
                            class="blue-btn" type="primary" 
                            @click="reEdit" icon="form">重新编辑</a-button>

                            <a-button
                            v-if="transferLetterData.fwjlx !== '.pdf'"
                            style="margin-right: 15px;" 
                            class="blue-btn" type="primary" 
                            @click="saveFiles" icon="folder">保存</a-button>

                            <a-button
                            v-if="transferLetterData.fwjlx !== '.pdf'"
                            style="margin-right: 15px;" 
                            class="blue-btn" type="primary" 
                            @click="generatePDFClick" icon="file-pdf">生成PDF</a-button>

                            <a-button
                            v-if="transferLetterData.fwjlx == '.pdf'"
                            style="margin-right: 15px;" 
                            class="blue-btn" type="primary" 
                            @click="stampClick" icon="audit">盖章</a-button>

                            <a-button
                            v-if="transferLetterData.fwjlx !== '.pdf'"
                            style="margin-right: 15px;"
                            class="blue-btn" type="primary" 
                            @click="generatePDFStampClick" icon="audit">生成PDF并盖章</a-button>

                            <a-button 
                            v-if="transferLetterData.fwjlx !== '.pdf'"
                            class="blue-btn" type="primary" 
                            @click="reSelectTemplate" icon="select">重新选择模板</a-button> -->
                        </div>
                        <div :key="iframeKey" style="display: flex;justify-content: center;">
                            <iframe 
                                v-if="transferLetterIframeSrc"
                                :key="iframeKey"
                                :src="transferLetterIframeSrc" 
                                ref="iframeServerEditingRef" 
                                scrolling="auto" 
                                width="100%"
                                :height="(windowInnerHeight -170 )+'px'"
                                style="border: 0;"
                            ></iframe>
                            <div v-else>
                                <a-empty description="暂无文件或文件发生错误！"/>
                            </div>
                        </div>
                        <!-- {{ programData }} -->
                    </div>
                    <div v-else>
                        <a-upload style="display: inline-block;" :beforeUpload="$event=>{return false}" :showUploadList="false" action="" @change="singleUploadCahnge($event,'移送函')">
                            <a-button
                            class="blue-btn" 
                            style="width: 124px;"
                            type="primary" icon="upload">上传</a-button>
                        </a-upload>
                        <!-- <selectTemplateNoModel
                        :key="programSpinningKey"
                         ref="selectTemplateNoModel2Ref" 
                         @selectTemplateComplete="selectTemplateComplete" 
                         @programSpinningChange="programSpinningChange" /> -->
                    </div>
                </a-spin>
            </div>
            <div v-show="activeKey == '技术审评材料汇总'">
                <div style="margin-bottom: 10px;" class="departmentReview-table-box">
                    <table border bordercolor="#d9d9d9" style="width: 100%; margin-bottom: 15px;" >
                        <tr>
                            <th style="background: rgb(222, 229, 237) !important;" colspan="2">
                                <div style="display: flex;justify-content: space-between;align-items: center;" >
                                    <span>综合评定材料</span>
                                </div>
                            </th>
                        </tr>
                        <tr v-for="(item,index) in reviewDocumentsList" :key="index" class="file-list-v-examination" >
                            <td>
                                <div style="display: flex;align-items: center;">
                                    <span style="font-size: 14px;font-weight: 600;"  class="directory-list-fmlmc">{{ item.clmc }}</span>
                                </div>
                                
                            </td>
                            <td>
                                <div class="file-for-box"  v-if="item.clmc !== '审核件'" >
                                    <div class="file-for-box "  style="display: flex;flex-direction: column;">
                                        <div v-for="(trem,tIndex) in item.wjList" 
                                            style="display: flex;align-items: center;flex-direction: row;height: auto;justify-content: flex-start"
                                            
                                        >
                                            <div class="toolbox-fileList-box" >
                                                <div class="toolbox-file-coontern" style="margin-right: 5px;">
                                                <span class="toolbox-file-name" style="-webkit-line-clamp: 1;" @click.top.prevent="viewFinalFileClick(trem)"><a href="#">{{ trem.fwjxsmc+trem.fwjlx }}</a></span>
                                                </div>
                                                <div class="fileList-icon-btn" style="flex: none;">
                                                    <a-icon type="download" class="toolbox-download-icon-type" style="display: inline-block;margin-right: 5px;font-size:16px;" @click.top.prevent="downloadFiles(trem)"/>
                                                    <!-- <a-icon type="eye" class="toolbox-eye-icon-type" style="padding: 0;margin: 0;margin-right: 5px;" @click.top.prevent="viewFinalFileClick(trem)"/> -->
                                                    <!-- <a-icon type="delete" class="toolbox-delete-icon-type" style="display: inline-block;margin-right: 5px;" @click.top.prevent="producerDelete({...item,...trem,index,tIndex})"/> -->
                                                </div>
                                            </div>
                                            
                                        </div>
                                    </div>
                                </div>
                                <div class="file-for-box"  v-else >
                                    <div class="file-for-box "  style="display: flex;flex-direction: column;">
                                        <div 
                                            style="display: flex;align-items: center;flex-direction: row;height: auto;justify-content: flex-start"
                                        >
                                            <div class="toolbox-fileList-box" >
                                                <div class="toolbox-file-coontern" style="margin-right: 5px;">
                                                <span class="toolbox-file-name" style="-webkit-line-clamp: 1;" @click.top.prevent="viewFinalFileClick(item)"><a href="#">符合性审评审核件</a></span>
                                                </div>
                                                <div class="fileList-icon-btn" style="flex: none;">
                                                    <a-icon type="eye" class="toolbox-eye-icon-type" style="padding: 0;margin: 0;margin-right: 5px;" @click.top.prevent="viewFinalFileClick(item)"/>
                                                    <!-- <a-icon type="delete" class="toolbox-delete-icon-type" style="display: inline-block;margin-right: 5px;" @click.top.prevent="producerDelete({...item,...trem,index,tIndex})"/> -->
                                                </div>
                                            </div>
                                            
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
                <div style="display: flex;" class="departmentReview-table-box">
                    <div style="width: 100%;" >
                        <table border bordercolor="#d9d9d9" style="width:100%; " >
                            <tr style="background: #dee5ed !important;">
                                <th style="color: #000;width: 250px;" >技术审评材料目录</th>
                                <th style="color: #000;width: 280px;" >情况说明</th>
                                <th style="color: #000;" >文件</th>
                                <!-- <th style="color: #000;width: 210px;" >操作</th> -->
                            </tr>
                            <!-- v-if="item.clmc == '缺席人员说明'" -->
                            <tr v-for="(item,index) in materialSummaryList" :key="index" v-if="item.clmc !== '缺席人员说明' || (item.clmc == '缺席人员说明' && item.wjList && item.wjList.length )" :style="{background:(index+1) % 2 == 0?'#f0f0f1':'#fff'}">
                                <td>
                                    <span :style="{color:item.wjList && item.wjList.length?'#000':'#ed5565'}" style="font-size: 14px;font-weight: 600;">{{ item.clmc }}</span>
                                    <span v-if="item.wjList && item.wjList.length" style="color: #1ab348;">（{{item.wjList.length}}份）</span>
                                </td>
                                <td style="color: #faad14;">
                                    <span v-if="item.clmc == '技术审评报告'"></span>
                                    <span v-if="item.clmc == '技术审评缺陷记录表'">如有，需要下载企业盖章</span>
                                    <span v-if="item.clmc == '技术审评纪律'"></span>
                                    <span v-if="item.clmc == '无利益冲突声明'"></span>
                                    <span v-if="item.clmc == '技术审评会议签到表'"></span>
                                    <span v-if="item.clmc == '技术审评审评员承诺书'"></span>
                                    <span v-if="item.clmc == '技术审评报告附件'">如有，需上传文件</span>
                                    <span v-if="item.clmc == '技术审评记录'"></span>
                                    <span v-if="item.clmc == '其他说明材料'">如有，需上传文件</span>
                                    <span v-if="item.clmc == '客户满意度调查表'"></span>
                                    <span v-if="item.clmc == '食品药品风险信息报送说明'">如有，需要下载企业盖章</span>
                                    <!-- <span v-if="item.clmc == '促进产业高质量发展调查表'">如有，需要下载企业盖章</span> -->
                                    <!-- <span v-if="item.clmc == '缺席人员说明'">如果有缺席人员，需上传文件说明(模板放在首次会议移送企业里面)</span> -->
                                </td>
                                <td style="text-align: center;">
                                    <div class="file-for-box "  style="display: flex;flex-direction: column;">
                                        <div v-for="(trem,tIndex) in item.wjList" 
                                            style="display: flex;align-items: center;flex-direction: row;height: auto;justify-content: flex-start"
                                            
                                        >
                                            <div class="toolbox-fileList-box" >
                                                <div class="toolbox-file-coontern" style="margin-right: 5px;">
                                                <span class="toolbox-file-name" style="-webkit-line-clamp: 1;" @click.top.prevent="viewFinalFileClick(trem)"><a href="#">{{ trem.fwjxsmc+trem.fwjlx }}</a></span>
                                                </div>
                                                <div class="fileList-icon-btn" style="flex: none;">
                                                    <a-icon type="download" class="toolbox-download-icon-type" style="display: inline-block;margin-right: 5px;font-size:16px;" @click.top.prevent="downloadFiles(trem)"/>
                                                    <a-icon type="eye" class="toolbox-eye-icon-type" style="padding: 0;margin: 0;margin-right: 5px;" @click.top.prevent="viewFinalFileClick(trem)"/>
                                                    <!-- <a-icon type="delete" class="toolbox-delete-icon-type" style="display: inline-block;margin-right: 5px;" @click.top.prevent="producerDelete({...item,...trem,index,tIndex})"/> -->
                                                </div>
                                            </div>
                                            
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <!-- <assignPersonnel ref="assignPersonnelRef" :key="assignPersonnelKey"/> -->
            </div>
            <div v-if="activeKey == '企业整改材料'">
                <materialRectification
                 @rectificationClick="rectificationClick" 
                 @historyListClick="historyListClick" 
                 ref="materialRectificationRef" 
                 :key="materialRectificationKey"
                 @renewDataChange="renewDataChange"
                />
            </div>
            <div v-show="activeKey == '申请信息'  || activeKey == '环节流转记录'" style="height: 100%;overflow: hidden;">
                <a-spin size="large" :spinning="modalSpinningPrice" tip="正在加载中...">
                    <eventSet
                        :key="eventSetKey" 
                        ref="examinationEventSetRef" 
                        @updatedSuccess="eventupdatedSuccess"
                    />
                </a-spin>
            </div>
            <selectTemplate ref="selectTemplateRef" @selectTemplateComplete="selectTemplateComplete"/>
            <serverEditingView ref="serverEditingViewRef" @refreshChange="$event=>{}"/>
            <serverEditing ref="serverEditingRef" @refreshChange="refreshChange"/>
            <viewFinalFile ref="viewFinalFileRef" />
        </div>
    </div>
</template>
<script>
import { 
    spcysaveFlow,
    spcyRsBhgzautoPdbhBySqsxId,
    spcyRsBhgzautoYshbhBySqsxId,
    spcygenerateZhpdConclusion,
    initWjgetZhpdBgsDjwc,
    initWjgetZhpdBgsCxbj,
    spcygetZhpdbgFile,
    spcygetZhpdYshFile,

    getWebOfficeDownloadFile,
    webOfficeApiopenFile,
    openFileReadOnly,
    getDocxToPdf,
    againEditPdfOnlineFile,
    getDocxToPdfAndGz,
    pdfFileHcCa,
    initWjgetZhpdBgsState,
    spcyqueryXcjcFileMl,
    spcySqsxWjjldeleteFileById,
    spcyuploadSqsxFile,
    spcySqsxWjjlgetLocalFileById,
    spcyzhpdclMlList,
    // initWjgetZhpdScyjState,
 } from './service/index'
 import YchConstant from "@/api/YchConstant";
 import blobType from '@/common/blobType'
 import eventSet from '../taskAcceptance/eventSet.vue'
import CommpStep from '../../../../../components/commp-step/commpStep.vue';
import assignPersonnel from '../onSiteInspection/sceneInspect.vue'
import compSelector from '@/components/compSelector/compSelector.vue'
import selectTemplateNoModel from '@/components/selectTemplate/selectTemplate-noModel.vue'
import selectTemplate from '@/components/selectTemplate/selectTemplate.vue'
import serverEditing from '@/components/comp-model-series/server-editing.vue'
import serverEditingView from '@/components/comp-model-series/server-editing-view'
import materialRectification from '../materialReview/enterpriseRectification.vue'
import viewFinalFile from '../onSiteInspection/viewFinalFile.vue'
export default {
    components:{
        eventSet,
        CommpStep,
        assignPersonnel,
        compSelector,
        selectTemplateNoModel,
        selectTemplate,
        serverEditing,
        serverEditingView,
        materialRectification,
        viewFinalFile,
    },
    props:{

    },
    data(){
        return{
            activeKey:'',
            currentRow:{},
            materialReviewExaminationKey:null,
            eventSetKey:null,
            assignPersonnelKey:null,
            fzhjgKey:null,

            programSpinning:false,
            programSpinningKey:null,
            programTemplateKey:null,
            programData:{},
            iframeSrc:'',
            iframeKey:null,

            transferLetterData:{},
            transferLetterIframeSrc:'',
            modalSpinningPrice:true,
            windowInnerHeight:window.innerHeight,
            materialRectificationKey:null,
            comprehensiveReportState:false,
            reviewCommentsState:false,
            materialSummaryList:[],
            reviewDocumentsList:[],
        }
    },
    watch:{

    },
    mounted(){
        
    },
    methods:{
        async getData(row){
            //console.log('综合评定',row)
            this.currentRow = row
            this.spinning = true
            if(!row.noFirstLoad){
                this.activeKey = row.isActiveKey?row.isActiveKey:'技术审评材料汇总'
                this.materialReviewExaminationKey = Date.now()
                this.assignPersonnelKey = Date.now()
            }
            this.fzhjgKey = Date.now()
            // this.$nextTick(()=>{
            //     this.$refs.assignPersonnelRef.getData({...row,isTopTabs:true,isActiveKey:'技术审评材料汇总',isZZState:true,boxHeight:170,leftMlHeigth:140,rightFielHeigth:140,comprehensiveBorder:true})
            // })
            
            // 
            if(row.isActiveKey == '企业整改材料'){
                this.tabPaneChange('企业整改材料')
            }else if(row.isActiveKey == '综合评定' && this.comprehensiveReportState){
                this.getReportData()
            }
            await this.getStateData()
            this.getAuditFormSingleItem()
            this.getMaterialSummary()
        },
        getStateData(){
            initWjgetZhpdBgsState({sqsxid:this.currentRow.sqsxid}).then(res=>{
                if(res.code == 200){
                    this.comprehensiveReportState = res.result
                }else{
                    this.comprehensiveReportState = false
                }
            })
            // initWjgetZhpdScyjState({sqsxid:this.currentRow.sqsxid}).then(res=>{
            //     if(res.code == 200){
            //         this.reviewCommentsState = res.result
            //     }else{
            //         this.reviewCommentsState = false
            //     }
            // })
        },
        getAuditFormSingleItem(){
            spcyzhpdclMlList({sqsxid:this.currentRow.sqsxid}).then(res=>{
                if(res.code == 200){
                    //console.log('我得到什么数据来打印',res)
                    this.reviewDocumentsList = res.result
                }else{
                    this.reviewDocumentsList = []
                }
            })
        },
        getMaterialSummary(){
            spcyqueryXcjcFileMl({sqsxid:this.currentRow.sqsxid}).then(res=>{
                if(res.code == 200){
                    //console.log('技术审评材料汇总',res.result)
                    this.materialSummaryList = res.result[0].mcList
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        viewFinalFileClick(trem){
            this.$refs.viewFinalFileRef.getData(trem)
            this.$refs.viewFinalFileRef.visible = true
        },
        //删除
        producerDelete(val,type){
            var that = this
            this.$confirm({
                title:'您确认要删除吗？',
                // icon: createVNode(ExclamationCircleOutlined),
                onOk() {
                    spcySqsxWjjldeleteFileById({id:val.id}).then(res=>{
                        if(res.code == 200){
                            if(type == '综合评定'){
                                that.getReportData()
                            }else if(type == '移送函报告'){
                                that.getTransferLetter()
                            }
                        }else{
                            that.$message.warning(res.message)
                        }
                    })
                },
                
            });
            
        },
        //上传
        singleUploadCahnge({file},val){
            var that = this
            if(file.name.indexOf('.pdf') !== -1 ){
                const fileData = new FormData();
                fileData.append("file",file);
                fileData.append("sqsxid",this.currentRow.sqsxid);
                fileData.append("type",val);
                spcyuploadSqsxFile(fileData).then(res => {
                    if(res.code !== 200){
                        that.$message.warning('请上传pdf文件或者联系管理员!')
                    }else{
                        that.getMaterialSummary(this.currentRow)
                        that.getFirstMeetingData(this.firstMeetingActiveValue)
                        that.$message.success('上传成功')
                        if(type == '综合评定报告书'){
                            this.getReportData()
                        }else if(type == '移送函'){
                            this.getTransferLetter()
                        }
                    }
                    
                })
            }else{
                this.$message.warning('请上传pdf文件')
            }
            
        },
        eventupdatedSuccess(){
            this.modalSpinningPrice = false
        },
        tabPaneChange(val){
            if(val == '综合评定' && this.comprehensiveReportState){
                this.getReportData()
            }else if(val == '移送函报告'){
                this.getTransferLetter()
            }
            if(val == '申请信息'  || val == '环节流转记录'){
                // this.eventSetKey = Date.now()
                this.$refs.examinationEventSetRef.getDatas({...this.currentRow,tabPaneActiveKey:val,noFirstLoad:true,borderisFalse:true})
                this.modalSpinningPrice = true
                // this.$refs.examinationEventSetRef.$refs.dealWithRef.tabPaneChange(val)
            }
            if(val == '企业整改材料'){
                this.$nextTick(()=>{
                    setTimeout(()=>{
                        this.$refs.materialRectificationRef.getData({
                            sqsxid:this.currentRow.sqsxid,
                            jobid:this.currentRow.jobid,
                            isTopTabs:true,
                            isActiveKey:'材料审查',
                            reserveBottom:228,
                            rightPreviewBoxH:this.currentRow.rightPreviewBoxH?this.currentRow.rightPreviewBoxH:window.innerHeight - 410,
                            heightNum:176,
                            isRefresh:false,
                            fhjmc:this.currentRow.fhjmc,
                            isDelete:true,
                            fzhpdyj:this.currentRow.fzhpdyj,
                            isScyjBox:this.currentRow.isScyjBox,
                            fsxmc:this.currentRow.fsxmc,
                            fqymc:this.currentRow.fqymc,
                            isCxbjSCYJBtn:true,
                        })
                    },200)
                })
            }
        },
        //取号
        numbering(name){
            if(name == '评定编号'){
                spcyRsBhgzautoPdbhBySqsxId({sqsxid:this.currentRow.sqsxid}).then(res=>{
                    if(res.code == 200){
                        this.currentRow.fpdbh = res.result.fpdbh
                        // this.$message.success(res.message)
                        this.saveData('fpdbh',this.currentRow.fpdbh)
                    }else{
                        this.$message.warning(res.message)
                    }
                })
            }else if(name == '移送编号'){
                spcyRsBhgzautoYshbhBySqsxId({sqsxid:this.currentRow.sqsxid}).then(res=>{
                    if(res.code == 200){
                        this.currentRow.fyshbh = res.result.fyshbh
                        // this.$message.success(res.message)
                        this.saveData('fyshbh',this.currentRow.fyshbh)
                    }else{
                        this.$message.warning(res.message)
                    }
                })
            }else if(name == '生成报告内容'){
                if(this.currentRow.fzhjg){
                    spcygenerateZhpdConclusion({sqsxid:this.currentRow.sqsxid}).then(res=>{
                        if(res.code == 200){
                            this.currentRow.fzhjl = res.result.fzhjl
                            // this.$message.success(res.message)
                            this.saveData('fzhjl',this.currentRow.fzhjl)
                        }else{
                            this.$message.warning(res.message)
                        }
                    })
                }else{
                    this.$message.warning('请先选择综合评定结论')
                }
                
            }
        },
        // 生成综合评定报告书
        generateReportChange(val){
            if(val == '完成'){
                initWjgetZhpdBgsDjwc({sqsxid:this.currentRow.sqsxid}).then(res=>{
                    if(res.code == 200){
                        this.$message.success(res.message)
                        this.comprehensiveReportState = true
                        this.getReportData()
                        // this.$nextTick(()=>{
                        //     this.$refs.selectTemplateNoModel1Ref.getSelectTemplate({},'综合评定报告书',this.currentRow.sqsxid)
                        //     this.$refs.selectTemplateNoModel1Ref.selectTemplateVisible = true
                        // })
                    }else{
                        this.$message.warning(res.message)
                    }
                })
            }else{
                initWjgetZhpdBgsCxbj({sqsxid:this.currentRow.sqsxid}).then(res=>{
                    if(res.code == 200){
                        this.$message.success(res.message)
                        this.comprehensiveReportState = false
                    }else{
                        this.$message.warning(res.message)
                    }
                })
            }
        },
        //报告制作
         getReportData(){
            spcygetZhpdbgFile({sqsxid:this.currentRow.sqsxid}).then(res=>{
                if(res.code == 200){
                    this.programData = res.result.length?res.result[0]:{}
                    if(res.result.length){
                        if(this.programData.fwjlx == '.pdf'){
                            this.iframeSrc = bootConfig[process.env.NODE_ENV].locality_ApI + YchConstant.SPZX_SPCY + '/spcyRsWjmb/openWjjl?id='+this.programData.id
                            this.iframeKey = Date.now()
                        }else{
                            this.openFileClick(this.programData)
                        }
                        
                    }else{
                        this.$nextTick(()=>{
                            this.$refs.selectTemplateNoModel1Ref.getSelectTemplate({},'综合评定报告书',this.currentRow.sqsxid)
                            this.$refs.selectTemplateNoModel1Ref.selectTemplateVisible = true
                        })
                        //console.log('我校在这里')
                    }
                    this.programSpinningKey = Date.now()
                    this.programTemplateKey = Date.now()
                }
                this.programSpinning = false
            })
         },
         //移送函
         getTransferLetter(){
            spcygetZhpdYshFile({sqsxid:this.currentRow.sqsxid}).then(res=>{
                if(res.code == 200){
                    this.transferLetterData = res.result.length?res.result[0]:{}
                    if(res.result.length){
                        if(this.transferLetterData.fwjlx !== '.doc' && this.transferLetterData.fwjlx !== '.docx'){
                            this.transferLetterIframeSrc = bootConfig[process.env.NODE_ENV].locality_ApI + YchConstant.SPZX_SPCY + '/spcyRsWjmb/openWjjl?id='+this.transferLetterData.id
                            this.iframeKey = Date.now()
                        }else{
                            this.openFileClick(this.transferLetterData)
                        }
                        
                    }else{
                        this.$nextTick(()=>{
                            this.$refs.selectTemplateNoModel2Ref.getSelectTemplate({},'移送函',this.currentRow.sqsxid)
                            this.$refs.selectTemplateNoModel2Ref.selectTemplateVisible = true
                        })
                    }
                    this.programSpinningKey = Date.now()
                }
                this.programSpinning = false
            })
         },
         openFileClick(val){//打开文件
            webOfficeApiopenFile({id:val.id}).then(res=>{
                if(res.code == 200){
                    if(this.activeKey == '综合评定'){
                        this.iframeSrc = res.result.wordUrl
                    }else{
                        this.transferLetterIframeSrc = res.result.wordUrl
                    }
                    
                    this.iframeKey = Date.now()
                }else{
                    this.$message.warning(res.message)
                }
            })
        },

        refreshFile(){//刷新
            if(this.activeKey == '综合评定'){
                this.getReportData()
            }else{
                this.getTransferLetter()
            }
            
            
        },

        downloadFiles(val){//下载
            var that = this
            var fileName = val.fwjccmc
            let param = { fywflcode:'001002',id:val.id,sqsxid:this.currentRow.sqsxid}
            spcySqsxWjjlgetLocalFileById(param).then((data) => {
                if (!data) {
                    that.$message.warning('文件下载失败')
                return
                }
                    let url = window.URL.createObjectURL(new Blob([data], { type: blobType.type[blobType.suffix.indexOf(val.fwjlx)] }))
                    let link = document.createElement('a')
                    link.style.display = 'none'
                    link.href = url
                    link.setAttribute('download', fileName + val.fwjlx)
                    document.body.appendChild(link)
                    link.click()
                    document.body.removeChild(link) //下载完成移除元素
                    window.URL.revokeObjectURL(url) //释放掉blob对象
            })
        },
        
        reEdit(){//重新编辑
            let data = {
                id:this.activeKey == '综合评定'?this.programData.id:this.transferLetterData.id
            }
            againEditPdfOnlineFile(data).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.message)
                    this.refreshFile()
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        saveFiles(){//保存
            let data = {
                id:this.activeKey == '综合评定'?this.programData.id:this.transferLetterData.id
            }
            getWebOfficeDownloadFile(data).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.message)
                    this.refreshFile()
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        
        generatePDFClick(){//生成PDF
            let data = {
                id:this.activeKey == '综合评定'?this.programData.id:this.transferLetterData.id
            }
            getDocxToPdf(data).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.message)
                    this.refreshFile()
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        
        stampClick(){//盖章
            let data = {
                id:this.activeKey == '综合评定'?this.programData.id:this.transferLetterData.id
            }
            pdfFileHcCa(data).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.message)
                    this.refreshFile()
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        
        generatePDFStampClick(){//生成PDF并盖章
            let data = {
                id:this.activeKey == '综合评定'?this.programData.id:this.transferLetterData.id
            }
            getDocxToPdfAndGz(data).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.message)
                    this.refreshFile()
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        refreshChange(){
            this.getNoticeMaterial(this.currentRow)
        },
        reSelectTemplate(){//重新选择模板
            //console.log('点击什么',this.programData)
            this.$refs.selectTemplateRef.getSelectTemplate(this.programData,this.activeKey == '综合评定'?'综合评定报告书':'移送函',this.currentRow.sqsxid)
            this.$refs.selectTemplateRef.selectTemplateVisible = true
        },
         //选择模板
        selectTemplateComplete(val){
            if(val == '综合评定报告书'){
                this.getReportData()
            }else{
                this.getTransferLetter()
            }
            
        },
         programSpinningChange(){
            this.programSpinning = true
        },
        rectificationClick(val){
            this.$emit('rectificationClick',val)
        },
        historyListClick(val){
            this.$emit('historyListClick',val)
        },
        //从其他组件更新数据过来
        renewDataChange({name,value}){
            this.currentRow[name] = value
        },
        //保存
        saveData(name,value,obj){
            let data = {
                jobid:this.currentRow.jobid,
                sqsxid:this.currentRow.sqsxid,
                opinion:'',
                smgflag:'否',
                map:{}
            }
            if(name){
                data.map[name] = value
            } else if(obj){
                data.map = {...obj}
            } else{
                data.map = { ...this.currentRow,}
            }
            spcysaveFlow(data).then(res=>{
                if(res.code == 200){
                    this.$message.success(res.message)
                }else{
                    this.$message.warning(res.message)
                }
                this.successChange()
            })
        },
    }
}
</script>
<style lang="less">
//1
.handle-comprehensive-box{
    width: 100%;
    
    // padding: 2px 5px 5px 5px;
    overflow-y: auto;
    // background-color: #fff;
    // .material-review-tabs{
    //     // width: 100%;
    //     padding: 0 5px;
    //     background-color: #fff;
    //     position: relative;
    //     // top: 48px;
    //     top: 0;
    //     right: 0;
    //     // margin:0 10px;
    //     font-size: 20px !important;
    //     font-weight: 600 !important;
    //     .ant-tabs-bar{
    //         margin: 0;
    //     }
    //     .ant-tabs-nav .ant-tabs-tab{
    //         padding-top: 5px;
    //         padding-bottom: 5px;
    //         margin-right: 10px;
    //     }
    //     .ant-tabs-nav-container{
    //         height: 50px !important;
    //     }
    //     .ant-tabs-nav-scroll{
    //         padding-top: 10px;
    //         padding-left: 10px;
    //     }
    // }
    // .ant-tabs-tab-active{
    //     font-size: 16px;
    //     font-weight: 600 !important;
    // }
    // .ant-tabs-tab{
    //     font-size: 16px;
    //     font-weight: 600 !important;
    //     line-height: 28px !important;
    //     border-radius: 10px 10px 0 0 !important;
    // }
    // .ant-tabs-tab-active{
    //     background-color: #5ca3e5 !important;
    //     color: #fff !important;
    //     border-color: #5ca3e5 !important;
    //     box-shadow: 0px 0px 12px 0px #5ca3e5;
    // }
    .comprehensive-review-content{
        // margin: 5px;
        padding: 5px;
        height: calc(100vh - 157px);
        background-color: #fff;
        overflow-y: auto;
        // box-shadow: 0px 0px 12px -3px #69a3d9;
        border:1px solid #38f;
        border-top: 0;
    }
}
//2
.handle-comprehensive-box{
    .review-table{
        th{
            text-align: center;
            padding: 10px;
        }
        td{
            padding: 10px;
        }
    }
    .file-list-v{
        .file-for-box{
            // display: flex;
            // flex-wrap: wrap;
        }
        .file-for-v{
            width: 130px;
            height: 130px;
            border-radius: 2px;
            border: 1px solid #d9d9d9;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            padding: 5px;
            margin: 5px;
            .file-icon-box{
                display: flex;
                justify-content: space-between;
                .file-icon-v{
                    font-size: 42px;
                    color: rgb(24, 144, 255);
                    padding: 7px;
                }
                .left-box{
                    width: 28px;
                }
                .right-box{
                    display: flex;
                    flex-direction: column;
                    justify-content: space-between;
                    padding-bottom: 2px;
                    .eye-icon-v{
                        font-size: 18px;
                        color: rgb(24, 144, 255);
                    }
                }
            }
            
            .name-fclmc-text{
                height: 60px;
                text-align: center;
                display:block;
                text-overflow: -o-ellipsis-lastline;
                overflow: hidden;
                text-overflow: ellipsis;
                display: -webkit-box;
                // display: flex;
                // flex-direction: column;
                // justify-content: center;
                -webkit-line-clamp: 3;
                line-clamp: 3;
                -webkit-box-orient: vertical;
                font-size: 14px;
            }
        }
        
    }
    .business-number{
        display: flex;
        margin: 6px 0;
        // justify-content: space-between;
        align-items: center;
        .business-number-dg{
            // width: 332px;
            margin-right: 30px;
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            .business-name{
                display: inline-block;
                width: 130px;
                text-align: right;
            }
        }
    }
    .business-name-text{
        text-align: right;
        width: 105px;
    }

    
}
.processing-content-right-v{
    margin-left: 150px;
    background-color: #fff;
}
.departmentReview-table-box{
    th{
        padding: 10px;
        text-align: center;
    }
    td{
        padding:10px 15px;
    }
    .file-for-box{
        display: flex;
        flex-wrap: wrap;
        .toolbox-fileList-box{
            // width: 104px;
            // height: 98px;
            // margin: 10px;
            padding: 5px;
            margin: 5px;
            margin-left: 0;
            display: flex;
            // flex-direction: column;
            justify-content: center;
            overflow: hidden;
            border: 1px solid #d9d9d9;
            .fileList-icon-btn{
                // flex: 1;
                display: flex;
                justify-content: space-around;
                align-items: center;
                .toolbox-filePdf-icon-type{
                    font-size: 40px;
                    color: #229dfc;
                    display: inline-block;
                    margin-top: 8px;
                }
                .left-icon-btn,.right-icon-btn{
                    padding: 7px 0;
                    width: 15px;
                    display: flex;
                    flex-direction: column;
                    justify-content: space-between;
                }
                .toolbox-delete-icon-type{
                    color: #ed5565;
                }
                .toolbox-eye-icon-type{
                    color: #1ab394;
                    display: inline-block;
                    margin-top: 8px;
                }
                .toolbox-download-icon-type{
                    color: #229dfc;
                }
                .toolbox-upload-icon-type{
                    color: #229dfc;
                    display: inline-block;
                    margin-top: 8px;
                }
            }
            .toolbox-file-coontern{
                display: flex;
                justify-content: center;
                align-items: center;
                padding: 0 3px;
                // height: 42px;
                .toolbox-file-name{
                    
                    // flex: 1;
                    text-align: center;
                    display: -webkit-box;
                    overflow: hidden;
                    text-overflow: ellipsis;
                    -webkit-line-clamp: 2; /* 控制最大行数 */
                    -webkit-box-orient: vertical;
                }
            }
        }
        .select-last-meeting-box{
            background-image: linear-gradient(to bottom, #e7f3ff, #fff, #e7f3ff, #e7f3ff, #e7f3ff, #e7f3ff, #e7f3ff, #e7f3ff, #e7f3ff);
            background-size: 100% 100% !important;
            border: 3px solid #ff9200 !important;
        }
    }
}
</style>